﻿using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using Volo.Abp.Domain.Entities;

namespace Ebusiness_PaymentService.Model
{
    [Table("T_OrderPayment")]
    public class OrderPayment : Entity<Guid>
    {
        //public Guid Id { get; set; } = Guid.NewGuid();         // 支付记录唯一标识
        [MaxLength(200)]
        public string? OrderNo { get; set; }                    // 系统订单号
        [MaxLength(200)]
        public string? PaymentNo { get; set; }                  // 系统支付单号（可与 OrderNo 不同）
        [MaxLength(200)]
        public string? ExternalTradeNo { get; set; }            // 第三方支付平台交易号（如微信/支付宝）
        [MaxLength(200)]
        public string? PaymentChannel { get; set; }             // 支付渠道，如 "Alipay", "WeChat", "Stripe"
        [MaxLength(200)]
        public string? PaymentMethod { get; set; }              // 支付方式，如 "App", "Web", "QR"

        public decimal? TotalAmount { get; set; }               // 实际支付金额（元）
        [MaxLength(200)]
        public string? Currency { get; set; } = "CNY";          // 币种，默认人民币
        [MaxLength(200)]
        public string? Status { get; set; }                     // 支付状态：Pending, Success, Failed, Canceled
        [MaxLength(200)]
        public string? FailReason { get; set; }                 // 支付失败原因（可空）

        public DateTime? PaidTime { get; set; }                // 支付成功时间
        public DateTime CreatedAt { get; set; } = DateTime.UtcNow; // 创建时间
        public DateTime? UpdatedAt { get; set; }               // 更新时间

        public bool IsDeleted { get; set; } = false;
    }
}
